<?php
$res_gru_id = sql("SELECT * FROM grupo WHERE status='1' ORDER BY gru_id2,gru_nome");
while($linha_gru_id = mysql_fetch_array($res_gru_id)) {
?>
<input name="gru_id[]" type="checkbox" value="<?=$linha_gru_id['gru_id'];?>" <?php if (count($gru_id) >0) { if (in_array($linha_gru_id['gru_id'],$gru_id)) { echo "checked"; } } ?>/> <?=$linha_gru_id['gru_nome'];?><br>
<? } ?>